package com.marry.business.repository.user;

import com.marry.contract.domain.Role;
import com.marry.contract.vo.RoleVo;
import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.r2dbc.repository.R2dbcRepository;
import reactor.core.publisher.Flux;

/**
 * @path：com.marry.mapper.RoleMapper.java
 * @className：RoleMapper.java
 * @description：角色
 * @author：杨超
 * @dateTime：2020/11/19 15:09
 * @editNote：
 */
public interface RoleRepository extends R2dbcRepository<Role, String> {

    @Query("select r.id,r.name,r.value,r.tips,r.create_time,r.update_time,r.status\n" +
            "        from sys_role r\n" +
            "        inner join sys_user_role ur on r.id=ur.role_id\n" +
            "        where ur.user_id = :userId")
    Flux<RoleVo> getRoleByUserId(String userId);

}
